package com

import (
	"bp/conf"
	"bp/db"
	"bp/internal/nsqserver/producer"
	apportionCom "bp/internal/service/com/apportioner"
	nsqMallCom "bp/internal/service/com/nsqMall"
	nsqPayCom "bp/internal/service/com/nsqPay"
	offerCom "bp/internal/service/com/offer"
	staterCom "bp/internal/service/com/stater"
	"bp/internal/service/entity"
	"go.uber.org/zap"
)

type ComHub struct {
	slog             *zap.SugaredLogger
	ApportionService *apportionCom.ApportionerComServiceImp
	NsqMallService   *nsqMallCom.NsqMallComServiceImp
	NsqPayService    *nsqPayCom.NsqPayComServiceImp
	OfferService     *offerCom.OfferComServiceImp
	StaterService    *staterCom.StaterComServiceImp
}

// NewComHub initialization
func NewComHub(
	slog *zap.SugaredLogger,
	pgdao *db.PgDao,
	vars *conf.VarsSection,
	pub *producer.NsqProducerProxy,
	entityHub *entity.EntityHub,
	// proxy *client.GrpcClientProxy,
	// adp *cache.Adapter,
) (hub *ComHub) {

	hub = &ComHub{
		slog:             slog.With("module", "ComHub"),
		ApportionService: apportionCom.New(pgdao, slog, vars, pub, entityHub),
		NsqMallService:   nsqMallCom.New(pgdao, slog, vars, entityHub),
		NsqPayService:    nsqPayCom.New(pgdao, slog, vars, entityHub),
		OfferService:     offerCom.New(pgdao, slog, vars, entityHub),
		StaterService:    staterCom.New(pgdao, slog, vars, entityHub),
		// cacher:           adp,
		// activityService: activityService,
	}

	return
}
